﻿using System;
using System.Windows.Forms;
using System.Threading;

namespace UI
{
    public partial class ResetData : Form
    {
        public ResetData()
        {
            InitializeComponent();
        }

        private void ResetData_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            button2.Enabled = false;
            button1.Enabled = false;

            LoadingManager.Show();

            Thread t = new Thread(GetData);
            t.IsBackground = true;
            t.Start();
        }
        delegate void InsertEndHandler();
        void GetData()
        {
            new Lottery.App.BLL.LotteryManager().Reset();

            Invoke(new InsertEndHandler(InsertEnd));
            
        }

        void InsertEnd()
        {
            LoadingManager.Hide();

            MessageBox.Show("处理完毕!", "提示");

            this.Close();
        }
    }
}
